package nbcp.web.sys

import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.web.bind.annotation.RestController
import nbcp.base.comm.*
import nbcp.base.extend.*
import nbcp.comm.JsonpMapping
import nbcp.db.mongo.entity.AdminUser
import nbcp.db.mongo.entity.SysUser
import nbcp.db.mongo.mor
import nbcp.db.mongo.match
import nbcp.db.mongo.query
import nbcp.web.UserId

import javax.servlet.http.HttpServletRequest

/**
 * Created by udi on 17-5-23.
 */

@RestController
@JsonpMapping("/loginInfo")
class LoginInfo_Controller {
    @ApiOperation(value = "获取登录者信息")
    @JsonpMapping("/getMine")
    fun getMine(session: HttpServletRequest): ApiResult<AdminUser> {
        var usr = mor.admin.adminUser.query().where{it.id match session.UserId}.toEntity()
        var ret = ApiResult.of(usr);
        return ret;
    }
}

